from django.shortcuts import render
from roles.rolesDAO import userDAO
import logging
import json
from roles.rolesDAO import userDAO
from django.http import HttpResponseRedirect

rolesDao = userDAO()
# Create your views here.
#index

logger = logging.getLogger('free_time.roles.views')
def login(request):
    return render(request, 'public/login.html')

def commonIndexPage(request):
    #参数检查
    groupId = request.GET['groupId']
    print("groupId="+groupId)
    url = rolesDao.getDefaultGourpUrl(groupId)
    if url:
        return HttpResponseRedirect(url['url'])
    else:
        return HttpResponseRedirect('roles/pageNotFound')
